home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* GALer-Software */
- /* */
- /* Soft- and Hardware is copyright (c) 1991-1993 */
- /* by Christian Habermann */
- /* Asamstr. 17 */
- /* 85356 Freising */
- /* Germany */
- /* */
- /* All rights reserved. */
- /* */
- /* This is Version 1.5 of GALer. */
- /* */
- /* used Compiler: SAS-C 6.3 */
- /* */
- /****************************************************************/
-
-
- #define STRINGARRAY 1
-
- #include <devices/parallel.h>
- #include <exec/io.h>
- #include <exec/memory.h>
- #include <exec/ports.h>
- #include <exec/types.h>
- #include <graphics/gfxbase.h>
- #include <graphics/text.h>
- #include <graphics/displayinfo.h>
- #include <intuition/intuition.h>
- #include <libraries/dosextens.h>
- #include <libraries/reqtools.h>
- #include <libraries/locale.h>
- #include <libraries/gadtools.h>
- #include <stdlib.h>
-
- #include <clib/alib_protos.h>
- #include <proto/locale.h>
- #include <proto/reqtools.h>
- #include <proto/intuition.h>
- #include <proto/exec.h>
- #include <proto/gadtools.h>
-
-
- #include "GALer.h"
- #include "Localize.h"
-
-
-
- #define Menu_1 0
- #define Menu_2 1
- #define Menu_3 2
- #define Menu_4 3
- #define Menu_5 4
- #define Menu_6 5
-
- #define Item_1 0
- #define Item_2 1
- #define Item_3 2
- #define Item_4 3
- #define Item_5 4
- #define Item_6 5
- #define Item_7 6
- #define Item_8 7
- #define Item_9 8
- #define Item_10 9
-
- #define SubItem_1 0
- #define SubItem_2 1
- #define SubItem_3 2
- #define SubItem_4 3
-
-
-
- #define AsmGad_CNT 8
- #define WriteGad_CNT 6
- #define JEDGad_CNT 4
- #define RAsm16_CNT 24
- #define RAsm20_CNT 28
- #define OptGad_CNT 2
- #define SelEd_CNT 3
-
-
- #ifdef LATTICE
- int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
- int chkabort(void) { return(0); } /* really */
- #endif
-
-
-
-
- extern struct ReqFileRequester MyFileReqStruct;
-
- extern struct NewGadget WriteNGad[], JEDNGad[], AsmNGad[], OptNGad[];
- extern struct NewGadget RAsm16NGad[], RAsm20NGad[], SelectEditorNGad[];
-
- extern UWORD WriteGTypes[], JEDGTypes[], AsmGTypes[], OptGTypes[];
- extern UWORD RAsm16GTypes[], RAsm20GTypes[], SelectEditorGTypes[];
-
- extern ULONG WriteGTags[], JEDGTags[], AsmGTags[], OptGTags[];
- extern ULONG RAsm16GTags[], RAsm20GTags[], SelectEditorGTags[];
-
-
-
-
- struct IORequest *CreateExtIO();
- struct IntuitionBase *IntuitionBase = 0;
- struct GfxBase *GfxBase = 0;
- struct LocaleBase *LocaleBase = 0;
- struct ReqToolsBase *ReqToolsBase = 0;
- struct Library *GadToolsBase = 0;
- struct IntuiMessage *message;
- struct Screen *screen;
- struct Window *window,*old_ReqWin;
- struct MsgPort *timeport, *parport;
- struct timerequest *timereq;
- struct IOExtPar *parreq;
- struct Menu *mainmenu, *pruefermenu;
- struct rtFileRequester *filereq;
- struct Gadget *WriteGList, *JEDGList, *AsmGList, *OptGList;
- struct Gadget *RAsm16GList, *RAsm20GList, *SelectEditorGList;
- struct Gadget *SelectEditorGadgets[SelEd_CNT];
-
-
-
- struct Catalog *catalog = 0;
-
- APTR VisualInfo;
-
-
-
- struct TextAttr topaz8 = { (STRPTR)"topaz.font", 8, 0x00, 0x01};
-
-
-
- UBYTE title[] = "GALer V1.5 © 1993 by Christian Habermann GAL16V8 ";
-
-
-
-
- struct NewMenu MainNewMenu[] = {
- /* Project menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, NULL, NULL,
- NM_SUB, (STRPTR)"V1.0, V1.1", NULL, CHECKIT, 6L, NULL,
- NM_SUB, (STRPTR)"V1.2", NULL, CHECKIT, 5L, NULL,
- NM_SUB, (STRPTR)"V1.3", NULL, CHECKIT, 3L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
-
- /* GAL-Type menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, CHECKIT, 14L, NULL,
- NM_ITEM, NULL, NULL, CHECKIT, 13L, NULL,
- NM_ITEM, NULL, NULL, CHECKIT, 11L, NULL,
- NM_ITEM, NULL, NULL, CHECKIT, 7L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, CHECKIT|MENUTOGGLE, 0L, NULL,
-
- /* GAL menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
-
- /* GAL-Assembler menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
-
- /* GAL-Disassembler menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
-
- /* Tools menu */
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_END, NULL, NULL, 0, 0L, NULL };
-
-
-
- struct NewMenu PrueferNewMenu[] = {
- NM_TITLE, NULL, NULL, 0, NULL, NULL,
- NM_ITEM, NULL, NULL, 0, 0L, NULL,
- NM_END, NULL, NULL, 0, 0L, NULL };
-
-
-
- struct ColorSpec ScreenColors[] = { 0, 0x0A, 0x0A, 0x0A,
- 1, 0x00, 0x00, 0x00,
- 2, 0x0F, 0x0F, 0x0F,
- 3, 0x06, 0x08, 0x0B,
- ~0, 0x00, 0x00, 0x00 };
-
-
- UWORD DriPens[] = { 0xFFFF };
-
-
-
-
-
- SHORT BorderVectors1[] = {0,0,17,0,17,9,0,9,0,0};
- struct Border Border1 = {-1,-1,2,3,JAM1,5,BorderVectors1,NULL};
- struct Border Border2 = {-1,-1,3,3,JAM1,5,BorderVectors1,NULL};
-
-
- struct IntuiText IText39 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText38 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText37 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText36 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText35 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText34 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText33 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText32 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText31 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
- struct IntuiText IText30 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"O", NULL};
-
-
- struct IntuiText IText23 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText22 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText21 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText20 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText19 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText18 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText17 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText16 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText15 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText14 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText13 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText11 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText10 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText9 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText8 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText7 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText6 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText5 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText4 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText3 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText2 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
- struct IntuiText IText1 = {2, 0, JAM2, 4, 0, NULL, (UBYTE *)"L", NULL};
-
-
-
- /* The gadgets for the symbolic GAL consist of several gadget lists.
- ** It depends on the GAL-type which gadget lists are used.
- ** Gadget numbers and gadget IDs less or equal 23 correspond with
- ** the pins of the GAL socket.
- ** The gadget lists are: Gadget23,22,2,1
- ** Gadget3,..,21 (without 12)
- ** Gadget30,..,37
- ** Gadget38
- ** Gadget39
- ** used gadgets:
- **
- ** GAL16V8: level gadgets Gadget3,..,21 and IO-select gadgets30,..,37
- ** GAL20V8: level gadgets Gadget3,..,21, Gadget23,22,2,1 and IO-select
- ** gadgets Gadget31,..37, Gadget38
- ** GAL22V10, level gadgets Gadget3,..,21, Gadget23,22,2,1 and IO-select
- ** gadgets Gadget30,..37, Gadget38, Gadget39
- ** GAL20RA10:
- */
-
- /* gadgets for the symbolic GAL */
-
- struct Gadget Gadget39 = {NULL,340,30,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText39,NULL,NULL,39,NULL};
-
-
- struct Gadget Gadget38 = {NULL,340,40,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText38,NULL,NULL,38,NULL};
-
-
-
- struct Gadget Gadget37 = {NULL,340,50,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText37,NULL,NULL,37,NULL};
-
- struct Gadget Gadget36 = {&Gadget37,340,60,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText36,NULL,NULL,36,NULL};
-
- struct Gadget Gadget35 = {&Gadget36,340,70,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText35,NULL,NULL,35,NULL};
-
- struct Gadget Gadget34 = {&Gadget35,340,80,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText34,NULL,NULL,34,NULL};
-
- struct Gadget Gadget33 = {&Gadget34,340,90,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText33,NULL,NULL,33,NULL};
-
- struct Gadget Gadget32 = {&Gadget33,340,100,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText32,NULL,NULL,32,NULL};
-
- struct Gadget Gadget31 = {&Gadget32,340,110,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText31,NULL,NULL,31,NULL};
-
- struct Gadget Gadget30 = {&Gadget31,340,120,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText30,NULL,NULL,30,NULL};
-
-
-
- struct Gadget Gadget21 = {NULL,382,50,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText21,NULL,NULL,21,NULL};
-
- struct Gadget Gadget20 = {&Gadget21,382,60,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText20,NULL,NULL,20,NULL};
-
- struct Gadget Gadget19 = {&Gadget20,382,70,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText19,NULL,NULL,19,NULL};
-
- struct Gadget Gadget18 = {&Gadget19,382,80,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText18,NULL,NULL,18,NULL};
-
- struct Gadget Gadget17 = {&Gadget18,382,90,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText17,NULL,NULL,17,NULL};
-
- struct Gadget Gadget16 = {&Gadget17,382,100,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText16,NULL,NULL,16,NULL};
-
- struct Gadget Gadget15 = {&Gadget16,382,110,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText15,NULL,NULL,15,NULL};
-
- struct Gadget Gadget14 = {&Gadget15,382,120,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border2,NULL,&IText14,NULL,NULL,14,NULL};
-
- struct Gadget Gadget13 = {&Gadget14,382,130,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText13,NULL,NULL,13,NULL};
-
- struct Gadget Gadget11 = {&Gadget13,242,120,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText11,NULL,NULL,11,NULL};
-
- struct Gadget Gadget10 = {&Gadget11,242,110,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText10,NULL,NULL,10,NULL};
-
- struct Gadget Gadget9 = {&Gadget10,242,100,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText9,NULL,NULL,9,NULL};
-
- struct Gadget Gadget8 = {&Gadget9,242,90,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText8,NULL,NULL,8,NULL};
-
- struct Gadget Gadget7 = {&Gadget8,242,80,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText7,NULL,NULL,7,NULL};
-
- struct Gadget Gadget6 = {&Gadget7,242,70,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText6,NULL,NULL,6,NULL};
-
- struct Gadget Gadget5 = {&Gadget6,242,60,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText5,NULL,NULL,5,NULL};
-
- struct Gadget Gadget4 = {&Gadget5,242,50,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText4,NULL,NULL,4,NULL};
-
- struct Gadget Gadget3 = {&Gadget4,242,40,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText3,NULL,NULL,3,NULL};
-
-
-
-
- struct Gadget Gadget1 = {NULL,242,20,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText1,NULL,NULL,1,NULL};
-
- struct Gadget Gadget2 = {&Gadget1,242,30,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText2,NULL,NULL,2,NULL};
-
- struct Gadget Gadget23 = {&Gadget2,382,30,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText23,NULL,NULL,23,NULL};
-
- struct Gadget Gadget22 = {&Gadget23,382,40,16,8,NULL,
- GADGIMMEDIATE+RELVERIFY,BOOLGADGET,
- (APTR)&Border1,NULL,&IText22,NULL,NULL,22,NULL};
-
-
-
-
-
- struct Process *myproc;
-
- struct RastPort *rp;
- struct ViewPort *vp;
-
- int pruef_mode;
-
- long monitorID;
-
-
- extern int GALType, MaxFuseAdr, SigAdr, hw_version;
-
- extern struct Configuration Config;
-
-
-
-
-
-
- void main(void)
- {
- ULONG class;
- USHORT code, gadID;
- struct Gadget *gad;
- struct MenuItem *menuitem;
-
-
-
-
- OpenStuff(); /*Libs, Windows... öffnen*/
-
-
- rp = window->RPort; /* RastPort- und Viewport-Zeiger */
- vp = &screen->ViewPort; /* initialisieren */
-
-
- /* Graphik an PAL/NTSC anpfassen */
- if (monitorID == PAL_MONITOR_ID) /* PAL ?*/
- DrawBevelBox(rp, 5L, 190L, 630L, 55L, GTBB_Recessed, TRUE, GT_VisualInfo, VisualInfo, TAG_DONE);
-
- DrawBevelBox(rp, 28L, 150L, 584L, 35L, GTBB_Recessed, TRUE, GT_VisualInfo, VisualInfo, TAG_DONE);
-
-
-
- if (GetParPort()) { /*Druckerport frei?*/
- puts((char *)AppStrings[MSG_ERR_PARPORT].as_Str);
- CloseStuff();
- exit(0);
- }
-
- if (GetTimer()) { /*Timer holen*/
- FreeParPort();
- puts((char *)AppStrings[MSG_ERR_TIMER].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- InitGALer(); /*Ausgänge von IC3,4,5 auf*/
- EnableOutput(); /*LOW schalten*/
-
- LoadConfig(); /* Voreinstellung laden */
-
-
-
- /* GadTools-Gadgets erstellen */
-
- if (InitMyGadgets()) {
- puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
- CloseStuff();
- FreeTimer();
- FreeParPort();
- exit(0);
- }
-
-
-
-
- for (;;) {
- Wait(1L << window->UserPort->mp_SigBit);
- while (message = (struct IntuiMessage *)GetMsg(window->UserPort)) {
-
- class = message->Class;
- code = message->Code;
-
- if (class == GADGETUP) {
- gad = (struct Gadget *)message->IAddress;
- gadID = gad->GadgetID;
- }
-
- ReplyMsg((struct Message *)message);
-
- switch (class) {
-
- case MENUHELP:
-
- if (pruef_mode == ON)
- HelpOnCheckerMenu(code);
- else
- HelpOnMainMenu(code);
-
- break;
-
-
- case MENUPICK:
-
- while (code != MENUNULL) {
- if (pruef_mode != ON)
- menuitem = ItemAddress(mainmenu, (ULONG)code);
- else
- menuitem = ItemAddress(pruefermenu, (ULONG)code);
-
-
- if (MENUNUM(code) != MENUNULL)
- ExecuteMenu(MENUNUM(code), ITEMNUM(code), SUBNUM(code));
-
- code = menuitem -> NextSelect;
- }
-
- break;
-
-
- case GADGETUP:
-
- if ((gadID < 100) && (pruef_mode == ON))
- Pruefer(gad, gadID);
-
- break;
-
-
- case RAWKEY:
-
- if (code == 0x5F) /* Help key? */
- Help();
-
- break;
-
- }
- }
- }
-
- } /*end of main*/
-
-
-
-
-
-
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- /* Subroutinen */
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-
-
- /*aufgerufenes Menü ausführen*/
- void ExecuteMenu(int menu, int item, int subitem)
- {
-
- if (pruef_mode == ON) {
- if ((menu == Menu_1) && (item == Item_1))
- TogglePruefer();
- }
- else {
-
- switch (menu) {
-
- case Menu_1: /* Projekt */
-
- switch (item) {
-
- case Item_1: /* About */
- About();
- break;
-
- case Item_2: /* Hardware-Version */
- switch (subitem) {
-
- case SubItem_1:
- hw_version = HW_GALER_1_0;
- break;
-
- case SubItem_2:
- hw_version = HW_GALER_1_2;
- break;
-
- case SubItem_3:
- hw_version = HW_GALER_1_3;
- break;
-
- }
- /* set 22V10 and */
- if (hw_version <= HW_GALER_1_2) { /* and 20RA10 menu */
- OffMenu(window, FULLMENUNUM(1, 2, 0));
- OffMenu(window, FULLMENUNUM(1, 3, 0));
-
- if (GALType == GAL22V10 || GALType == GAL20RA10)
- SetGALType(GAL16V8);
-
- }
- else {
- OnMenu(window, FULLMENUNUM(1, 2, 0));
- OnMenu(window, FULLMENUNUM(1, 3, 0));
- }
-
- Config.HardwareVersion = hw_version;
- InitGALer();
- break;
-
- case Item_3: /* Save Config. */
- SaveConfig();
- break;
-
- case Item_5: /* Quit */
- CloseStuff();
- FreeTimer();
- FreeParPort();
- exit(0);
- break;
-
- }
- break;
-
- case Menu_2: /* GAL-Typ */
-
- switch (item) {
-
- case Item_1:
- SetGALType(GAL16V8);
- break;
-
- case Item_2:
- SetGALType(GAL20V8);
- break;
-
- case Item_3:
- SetGALType(GAL22V10);
- break;
-
- case Item_4:
- SetGALType(GAL20RA10);
- break;
-
- case Item_6: /* Requester */
- Config.GALTypeReq = !Config.GALTypeReq;
- break;
-
- }
- break;
-
- case Menu_3: /*GAL*/
-
- switch (item) {
-
- case Item_1:
- ProgramGAL(); /*programmieren*/
- break;
-
- case Item_2: /*kopieren*/
- CopyGAL();
- break;
-
- case Item_3: /*löschen*/
- Loeschen();
- break;
-
- case Item_4: /*vergleichen*/
- Compare();
- break;
-
- case Item_5: /*Leertest*/
- Leertest();
- break;
-
- case Item_6: /*setze Sec.*/
- SetSecurity(YES);
- break;
-
- case Item_7:
- TestSecurity(); /*teste Sec.*/
- break;
-
- case Item_9:
- Schreibverhalten();
- break;
- }
- break;
-
- case Menu_4: /*GAL-Assembler*/
- if (item == Item_1) {
- AssembleInputFile(ASSEMBLER); /*Eingabe-Datei assemblieren*/
- break;
- }
- break;
-
- case Menu_5: /*GAL-Disassembler*/
-
- switch (item) {
-
- case Item_1:
- PrintSignature();
- break;
-
- case Item_2:
- PrintACW();
- break;
-
- case Item_3:
- GALInfo();
- break;
-
- case Item_5:
- PutJedec();
- break;
-
- case Item_6:
- JedecRequester();
- break;
-
- case Item_8:
- Reassembler();
- break;
- }
- break;
-
- case Menu_6: /*Tools*/
-
- switch (item) {
-
- case Item_1:
- PrintPinNames();
- break;
-
- case Item_2:
- ClearPinNames();
- break;
-
- case Item_3:
- TogglePruefer();
- break;
-
- case Item_5:
- Optimizer();
- break;
-
- case Item_7:
- SelectEditor();
- break;
-
- case Item_8:
- CallEditor();
- break;
-
- case Item_10:
- Help();
- break;
-
- }
- }
- }
- }
-
-
-
-
-
- /* Parallel-Port belegen
- */
- int GetParPort(void)
- {
-
- parport = (struct MsgPort *)CreatePort(0L,0L);
- if (parport == NULL)
- return(-1);
-
- parreq = (struct IOExtPar *) CreateExtIO(parport,(long)sizeof(struct IOExtPar));
- if (parreq == NULL) {
- DeletePort(parport);
- return(-1);
- }
-
- if (OpenDevice((BYTE *)"parallel.device",0L,(struct IORequest *)parreq,0L)) {
- DeleteExtIO((struct IORequest *)parreq);
- DeletePort(parport);
- return(-1);
- }
-
- InitParPort(); /*Datenrichtungsregister der CIAs*/
- /*initialisieren*/
- return(0);
- }
-
-
-
-
- /* Parallel-Port wieder freigeben
- */
- void FreeParPort(void)
- {
- RestoreParPort(); /*Datenrichtungsregister der CIAs restau-*/
- /*rieren, nicht aber den Zustand der Aus-*/
- /*gänge, da sonst der angeschlossene Brenner*/
- /*einen ungewollten Befehl erhalten könnte*/
- /*(Vcc on, VEdit on,...).*/
- CloseDevice((struct IORequest *)parreq); /* Port wieder freigeben */
- DeleteExtIO((struct IORequest *)parreq);
- DeletePort(parport);
- }
-
-
-
-
-
- /* Timer holen
- */
- int GetTimer(void)
- {
-
- timeport = (struct MsgPort *)CreatePort(0L,0L);
- if (timeport == NULL)
- return(-1);
-
- timereq=(struct timerequest *)AllocMem(
- (long)sizeof(struct timerequest),MEMF_PUBLIC);
- if (timereq == NULL) {
- DeletePort(timeport);
- return(-1);
- }
-
- timereq->tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE;
- timereq->tr_node.io_Message.mn_Node.ln_Pri = 0;
- timereq->tr_node.io_Message.mn_ReplyPort = timeport;
-
- if (OpenDevice (TIMERNAME, UNIT_MICROHZ, (struct IORequest *)timereq, 0L)) {
- FreeMem(&timereq, (long)sizeof(struct timerequest));
- DeletePort (timeport);
- return (-1);
- }
-
- return(0);
- }
-
-
-
-
-
- /* Timer-Device wieder freigeben
- */
- void FreeTimer(void)
- {
- CloseDevice ((struct IORequest *)timereq);
-
- FreeMem (timereq, (long)sizeof(struct timerequest));
-
- DeletePort (timeport);
- }
-
-
-
-
-
- /*
- ** micro: microsec. to wait
- ** secs: seconds to wait
- */
- void WaitForTimer(ULONG micro)
- {
-
- timereq->tr_node.io_Command = TR_ADDREQUEST;
- timereq->tr_time.tv_secs = 0;
- timereq->tr_time.tv_micro = micro;
-
- DoIO ((struct IORequest *)timereq);
- }
-
-
-
-
-
- /* Screen, Window, Libraries usw. öffnen
- */
- void OpenStuff(void)
- {
-
- int scr_height, win_height;
-
-
- if ((LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library", 38L)))
- catalog = OpenCatalog(NULL, (STRPTR)"GALer.catalog", OC_Version, 1, TAG_DONE);
-
- LocalizeText();
-
-
-
- if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37L))) {
- puts((char *)AppStrings[MSG_ERR_INTUITIONLIB].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- if (!(GadToolsBase = OpenLibrary("gadtools.library", 37L))) {
- puts((char *)AppStrings[MSG_ERR_GADTOOLSLIB].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 37L))) {
- puts((char *)AppStrings[MSG_ERR_GRAPHICSLIB].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- if (!(ReqToolsBase = (struct ReqToolsBase *)OpenLibrary(REQTOOLSNAME, REQTOOLSVERSION))) {
- puts((char *)AppStrings[MSG_ERR_REQTOOLSLIB].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- if (!(filereq = rtAllocRequestA(RT_FILEREQ, NULL))) {
- puts((char *)AppStrings[MSG_ERR_FILEREQ].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
- /* Screen und Window an PAL/NTSC anpassen*/
- if (GfxBase->DisplayFlags & NTSC) {
- scr_height = 200; /* NTSC */
- win_height = 189;
- monitorID = NTSC_MONITOR_ID;
- }
- else {
- scr_height = 256; /* PAL */
- win_height = 245;
- monitorID = PAL_MONITOR_ID;
- }
-
-
-
- if (!(screen = OpenScreenTags( NULL, SA_Left, 0,
- SA_Top, 0,
- SA_Width, 640,
- SA_Height, scr_height,
- SA_Depth, 2,
- SA_Colors, &ScreenColors[0],
- SA_Font, &topaz8,
- SA_Type, CUSTOMSCREEN,
- SA_DisplayID, monitorID|HIRES_KEY,
- SA_Pens, &DriPens[0],
- SA_Title, &title[0],
- TAG_DONE ))) {
- puts((char *)AppStrings[MSG_ERR_OPENSCREEN].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
-
-
- if (!(VisualInfo = GetVisualInfo(screen, TAG_DONE))) {
- puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
- CloseStuff();
- exit(0);
- }
-
-
-
- /* Hauptmenü erstellen */
-
- if (!(mainmenu = CreateMenus(MainNewMenu, GTMN_FrontPen, 0L, TAG_DONE))) {
- puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
- CloseStuff();
- exit(0);
- }
-
- LayoutMenus(mainmenu, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE);
-
-
-
- /* Menü für GAL-Prüfer erstellen */
-
- if (!(pruefermenu = CreateMenus(PrueferNewMenu, GTMN_FrontPen, 0L, TAG_DONE))) {
- puts((char *)AppStrings[MSG_ERR_MEMORY].as_Str);
- CloseStuff();
- exit(0);
- }
-
- LayoutMenus(pruefermenu, VisualInfo, GTMN_TextAttr, &topaz8, TAG_DONE);
-
-
-
-
- if (!(window = OpenWindowTags( NULL,
- WA_Left, 0,
- WA_Top, 11,
- WA_Width, 640,
- WA_Height, win_height,
- WA_IDCMP, IDCMP_MENUHELP|IDCMP_MENUPICK|IDCMP_GADGETUP|IDCMP_RAWKEY,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_ACTIVATE,
- WA_Title, NULL,
- WA_Gadgets, &Gadget3,
- WA_ScreenTitle, &title[0],
- WA_CustomScreen, screen,
- WA_MenuHelp, TRUE,
- TAG_DONE ))) {
- puts((char *)AppStrings[MSG_ERR_OPENWINDOW].as_Str);
- CloseStuff();
- exit(0);
- }
-
- SetMenuStrip( window, mainmenu );
- GT_RefreshWindow( window, NULL );
-
-
- myproc = (struct Process *)FindTask(0L); /*Requester umleiten*/
- old_ReqWin = (struct Window *)myproc->pr_WindowPtr;
- myproc->pr_WindowPtr = (APTR)window;
-
- }
-
-
-
-
- void CloseStuff(void)
- {
-
-
- myproc->pr_WindowPtr=(APTR)old_ReqWin; /*Req. auf ursprüngliches Window*/
-
-
- if (mainmenu) {
- ClearMenuStrip(window);
- FreeMenus(mainmenu);
- }
-
- if (pruefermenu) {
- ClearMenuStrip(window);
- FreeMenus(pruefermenu);
- }
-
-
- if ( window ) CloseWindow( window );
-
- if ( VisualInfo ) FreeVisualInfo (VisualInfo);
- if ( filereq ) rtFreeRequest (filereq);
- if ( screen ) CloseScreen (screen);
- if ( IntuitionBase ) CloseLibrary ((struct Library *)IntuitionBase);
- if ( GfxBase ) CloseLibrary ((struct Library *)GfxBase);
- if ( ReqToolsBase ) CloseLibrary ((struct Library *)ReqToolsBase);
-
- if ( LocaleBase ) {
- CloseCatalog(catalog);
- CloseLibrary ((struct Library *)LocaleBase);
- }
-
- if ( GadToolsBase ) {
- FreeGadgets(WriteGList);
- FreeGadgets(JEDGList);
- FreeGadgets(AsmGList);
- FreeGadgets(RAsm16GList);
- FreeGadgets(RAsm20GList);
- FreeGadgets(OptGList);
- FreeGadgets(SelectEditorGList);
- CloseLibrary ((struct Library *)GadToolsBase);
- }
-
- }
-
-
-
-
-
-
- /* InitMyGadgets
- ** initialisiert die GadTools-Gadgets
- ** Ergebnis: 0: alles o.k., 1: Fehler
- */
- int InitMyGadgets(void)
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD offx = screen->WBorLeft, offy = screen->WBorTop + screen->RastPort.TxHeight + 1;
-
-
- /* Gadgets für Schreibverhalten */
- if (!(g = CreateContext(&WriteGList)))
- return(1);
-
- for (lc = 0, tc = 0; lc < WriteGad_CNT; lc++) {
-
- CopyMem((char *)&WriteNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)WriteGTypes[lc], g, &ng, (struct TagItem *)&WriteGTags[tc]);
-
- while (WriteGTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
-
- /* Gadgets für JEDEC-Parameter */
- if (!(g = CreateContext(&JEDGList)))
- return(1);
-
- for (lc = 0, tc = 0; lc < JEDGad_CNT; lc++) {
-
- CopyMem((char *)&JEDNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)JEDGTypes[lc], g, &ng, (struct TagItem *)&JEDGTags[tc]);
-
- while (JEDGTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
-
- /* Gadgets für Assembler */
- if (!(g = CreateContext(&AsmGList)))
- return(1);
-
- for (lc = 0, tc = 0; lc < AsmGad_CNT; lc++) {
-
- CopyMem((char *)&AsmNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)AsmGTypes[lc], g, &ng, (struct TagItem *)&AsmGTags[tc]);
-
- while (AsmGTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
-
- /* Gadgets für Reassembler 16V8 */
-
- if (!(g = CreateContext(&RAsm16GList)))
- return(1);
-
- for (lc = 0, tc = 0; lc < RAsm16_CNT; lc++) {
-
- CopyMem((char *)&RAsm16NGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)RAsm16GTypes[lc], g, &ng, (struct TagItem *)&RAsm16GTags[tc]);
-
- while (RAsm16GTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
- /* Gadgets für Reasm. 20V8,22V10,20RA10 */
-
- if (!(g = CreateContext(&RAsm20GList)))
- return(1);
-
- for (lc = 0, tc = 0; lc < RAsm20_CNT; lc++) {
-
- CopyMem((char *)&RAsm20NGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)RAsm20GTypes[lc], g, &ng, (struct TagItem *)&RAsm20GTags[tc]);
-
- while (RAsm20GTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
- /* Gadgets für Optimizer */
-
- if (!(g = CreateContext(&OptGList)))
- return( 1L );
-
- for (lc = 0, tc = 0; lc < OptGad_CNT; lc++ ) {
-
- CopyMem((char * )&OptNGad[lc], (char * )&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- g = CreateGadgetA((ULONG)OptGTypes[lc], g, &ng, (struct TagItem *)&OptGTags[tc]);
-
- while (OptGTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
- /* gadgets of SelectEditor */
- if (!( g = CreateContext(&SelectEditorGList)))
- return( 1L );
-
- for (lc = 0, tc = 0; lc < SelEd_CNT; lc++ ) {
-
- CopyMem((char * )&SelectEditorNGad[lc], (char *)&ng, (long)sizeof(struct NewGadget));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = &topaz8;
- ng.ng_LeftEdge += offx;
- ng.ng_TopEdge += offy;
-
- SelectEditorGadgets[lc] = g = CreateGadgetA((ULONG)SelectEditorGTypes[lc], g, &ng, (struct TagItem *)&SelectEditorGTags[tc]);
-
- while (SelectEditorGTags[tc])
- tc += 2;
- tc++;
-
- if (NOT g)
- return(1);
- }
-
-
-
- return(0);
-
- }
-
-
-
-
-